#include <stdio.h>
#define  ROW 6
#define  COL 6
/* 函数功能：计算矩阵相乘之积，结果存于二维数组c中 */
void MultiplyMatrix(int a[ROW][COL], int b[COL][ROW], int c[ROW][ROW], int m, int n)//1
{	   		 		  
    int i, j, k;
    for (i = 0; i < m; i++)//1
    {	   		 		  
        for (j = 0; j < m; j++)//1
        {	   		 		  
            c[i][j] = 0;//1
            for (k = 0; k < n; k++)//1
            {	   		 		  
                c[i][j] = c[i][j] + a[i][k] * b[k][j];//1
            }
        }
    }
}	   		 		  
/* 函数功能：输出矩阵a中的元素 */
void  PrintMatrix(int a[ROW][ROW], int m)//1
{	   		 		  
    int i , j ;
    for (i = 0; i < m; i++)
    {	   		 		  
        for (j = 0; j < m; j++)
        {	   		 		  
            printf("%6d", a[i][j]);
        }
        printf("\n");
    }
}	   		 		  
int main()
{	   		 		  
    int a[ROW][COL], b[COL][ROW], c[ROW][ROW], i, j, m, n, ret;
    do
    {	   		 		  
        printf("Input m, n:");
        ret = scanf("%d,%d", &m, &n);//1
        if (ret != 2) while (getchar() != '\n');//1
    }while (m > 6 || n > 6 || ret != 2);//e1
    printf("Input %d*%d matrix a:\n", m, n);
    for (i = 0; i < m ; i++)
    {	   		 		  
        for (j = 0; j < n; j++)
        {	   		 		  
            scanf("%d", &a[i][j]);//1
        }
    }
    printf("Input %d*%d matrix b:\n", n, m);
    for (i = 0; i < n; i++)
    {	   		 		  
        for (j = 0; j < m; j++)
        {	   		 		  
            scanf("%d", &b[i][j]);//1
        }
    }
    MultiplyMatrix(a, b, c, m, n);//1
    printf("Results:\n");
    PrintMatrix(c, m);//1
    return 0;
}